/**
*      author: Y_Yao
*      created: 2024-11-28 17:39:22
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 1e4 + 7;
int a[N],dp[N][N];
int n,m;

void solve()
{
    cin >> n >> m;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
    }

    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= m;j++)
        {
            if(j == a[i]) dp[i][j] = dp[i-1][j] + 1;
            else if(j > a[i]) dp[i][j] = dp[i-1][j] + dp[i-1][j - a[i]];
            else dp[i][j] = dp[i-1][j];
        }
    }

    cout << dp[n][m] << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}